<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->increments('id')->comment('用户表');
            $table->tinyInteger('type')->unsigned()->default(1)->comment('添加类型，1用户，2机器人');
            $table->string('unionid', 28)->nullable();
            $table->string('openid', 28)->nullable()->comment('用户openid');
            $table->integer('finder_id')->unsigned()->default(0)->comment('推荐人ID');
            $table->string('avatar')->nullable()->comment('头像');
            $table->string('nickname', 20)->comment('昵称');
            $table->string('country', 50)->comment('国家');
            $table->string('province', 50)->comment('省份');
            $table->string('city', 50)->comment('城市');
            $table->tinyInteger('sex')->unsigned()->default(0)->comment('性别');
            $table->tinyInteger('block')->unsigned()->default(0)->comment('用户锁定状态：0-正常，3-封禁');
            $table->tinyInteger('status')->unsigned()->default(0)->comment('用户状态');
            $table->string('phone')->nullable()->comment('手机号');
            $table->string('password');
            $table->timestamp('status7_at')->comment('用户体验各个业务的状态');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user');
    }
}
